
package gfdclient;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author Алексей ID=2001
 */
public class AboutDialog extends javax.swing.JDialog {
    //private Image BannerImg;

    /** Creates new form AboutDialog */
    public AboutDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocation();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        txtInfo = new javax.swing.JTextArea();
        btnOk = new javax.swing.JButton();
        lblPict = new javax.swing.JLabel();
        lblAbout = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("О программе GFD");
        setBounds(new java.awt.Rectangle(0, 0, 879, 639));
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        txtInfo.setColumns(20);
        txtInfo.setEditable(false);
        txtInfo.setFont(new java.awt.Font("Monospaced", 0, 12));
        txtInfo.setRows(5);
        txtInfo.setAutoscrolls(false);
        jScrollPane1.setViewportView(txtInfo);

        btnOk.setFont(new java.awt.Font("Calibri", 1, 14));
        btnOk.setText("OK");
        btnOk.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnOk.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                btnOkStateChanged(evt);
            }
        });
        btnOk.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                btnOkMouseMoved(evt);
            }
        });
        btnOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOkActionPerformed(evt);
            }
        });

        lblPict.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gfdclient/logo.jpg"))); // NOI18N
        lblPict.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 0)));
        lblPict.setDoubleBuffered(true);

        lblAbout.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lblAbout.setText("<html>GFD Grid является разроботкой команды Gold Flimsy Development и распространяется по лицензии GNU General Public License (GPL). Для поучения дополнительной информации посетите сайт <a href=\"http://sites.google.com/site/gfdgrid/\">sites.google.com/site/gfdgrid</a>.</html> ");
        lblAbout.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE)
                    .addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(lblPict)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(lblAbout, 0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPict)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblAbout, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addComponent(btnOk)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    //-----------Рассчитать позицию окна авторизации на экране----------
    private void setLocation(){
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension dm = tk.getScreenSize();
        int xPos = dm.width/2 - getWidth()/2;
        int yPos = dm.height/2 - getHeight()/2;
        setLocation(xPos,yPos);
    }

    /**
     * Активация диалогового окна
     * @param evt
     */
    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        //Заполнить информацию о системе
        txtInfo.setText("Product Version: GFD Grid Client alpha" +
                "\nJava: "+
                System.getProperty("java.version")+ "; "+
                System.getProperty("java.vm.name")+ " "+
                System.getProperty("java.vm.version") +
                "\nSystem: "+
                System.getProperty("os.name")+ 
                " version "+ System.getProperty("os.version")+
                " runing on "+ System.getProperty("os.arch")
                );
    }//GEN-LAST:event_formWindowActivated

    private void btnOkMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnOkMouseMoved
        
}//GEN-LAST:event_btnOkMouseMoved

    private void btnOkStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_btnOkStateChanged
        
}//GEN-LAST:event_btnOkStateChanged

    private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
        setVisible(false);
}//GEN-LAST:event_btnOkActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnOk;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblAbout;
    private javax.swing.JLabel lblPict;
    private javax.swing.JTextArea txtInfo;
    // End of variables declaration//GEN-END:variables

}
